package com.sanyang.pda.presenter;

import com.google.gson.Gson;
import com.sanyang.pda.bean.ManualPalletBean;
import com.sanyang.pda.bean.PageBean;
import com.sanyang.pda.contract.ManualPalletContract;
import com.sanyang.pda.net.NetUtils;
import com.wangshen.base.net.bean.BaseRowsAppEntity;
import com.wangshen.base.ui.mvp.base.presenter.BasePresenter;

import java.util.List;

import io.reactivex.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.RequestBody;

public class ManualPalletPresenter extends BasePresenter<ManualPalletContract.View> implements ManualPalletContract.Presenter {
    @Override
    public void inboundList(int pageNum) {

        NetUtils.geApi().inboundList(pageNum,10)
                .compose(this.handleEverythingResult())
                .subscribe(new Consumer<BaseRowsAppEntity<List<ManualPalletBean>>>() {
                    @Override
                    public void accept(BaseRowsAppEntity<List<ManualPalletBean>> listBaseRowsAppEntity) throws Exception {
                            getView().setList(listBaseRowsAppEntity.getRows());
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                            getView().showMessage(throwable.getMessage());
                    }
                });
    }
}
